package com.mew.common.enm;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;


public enum UserType {

    Robot(-9),
    Common(0), //普通用户
    External(8),//外部代理
    Customer(9)//内部客服
    ;

    private final static Map<Integer, UserType> stateMap
            = Arrays.stream(UserType.values()).collect(Collectors.toMap(UserType::code, code -> code));

    private final int code;

    /**
     * @param code 代码
     */
    private UserType(final int code) {
        this.code = code;
    }

    public int code() {
        return this.code;
    }

    /**
     * @param code 代码
     * @return 转换出来的状态码
     */
    public static UserType parse(int code) {
        return stateMap.get(code);
    }


}
